<template>
  <div>
    <div class="application-log-con">
			<div class="application-log-btn">
				<!-- <a href="javascript:void(0)" class="application-log-btn-left">暂停推送</a>
				<a href="javascript:void(0)">下载历史日志</a>
				<a href="javascript:void(0)">查看最近1000条</a> -->
				<div class="clear"></div>
			</div>
			<div class="application-log-text">
				<p>{{log}}</p>
			</div>
		</div>
  </div>
</template>

<script>
export default {
  data () {
    return {
      log: '该应用无对外日志或日志未获取',
			nsName: '',
			podName: '',
			t1: ''
    }
  },
  methods: {
		routTo: function (path) {
			this.$router.push({
        path: path
      })
		},
		getList () {
			this.$api.get(0, '/kuber/con/page/info?page=1&limit=5&owner=' + sessionStorage.username + '&containerName=' + sessionStorage.containerName, {}, r => {
				if (r.data.code === 0) {
					this.nsName = r.data.data.data[0].nsName
					this.podName = r.data.data.data[0].podName
					this.$api.post(0, '/kuber/getLog', {nsName: this.nsName, podName: this.podName}, r => {
							this.log = r.data.data
					})
				}
			})
		}
  },
  mounted () {
		this.getList()
		setInterval(() => {
			this.getList()
		}, 15000)
  }
}
</script>

<style lang="scss">
.application-log-con{
	padding: 20px 40px;
	margin-top: 10px;
	background-color: #ffffff;
}
.application-log-btn{
	text-align: right;
	a{
		display: inline-block;
		width: 130px;
		height: 30px;
		line-height: 30px;
		text-align: center;
		font-size: 14px;
		color: #848484;
		border: 1px solid #f0f0f0;
		border-radius: 4px;
		margin-left: 30px;
		&.application-log-btn-left{
			width: 90px;
			height: 34px;
			line-height: 34px;
			color: #ffffff;
			background-color: #fe963a;
			border: none;
			float: left;
		}
	}
}
.application-log-text{
	border: 1px solid #f0f0f0;
	padding: 20px 40px;
	margin-top: 20px;
	max-height: 560px;
	overflow: auto;
	background: #333;
	p{
		font-size: 14px;
		line-height: 1.8;
		color: #fff
	}
}
</style>
